<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Joomla! 2.5 特色图片功能</title>
<link rel="stylesheet" href="../css/reset.css" type="text/css" />
<link rel="stylesheet" href="../css/prettify.css" type="text/css" />
<script type="text/javascript" src="../js/prettify.js"></script>
</head>
<body onload="prettyPrint();">
<h1>Joomla! 2.5 特色图片功能</h1>
<hr />
<h3>基于缩略图创建杂志布局图片</h3>
<pre class="prettyprint linenums">
&lt;?php $images = json_decode($article-&gt;images); ?&gt;
// ……
if (isset($images-&gt;image_intro) and !empty($images-&gt;image_intro)) :
	echo   "".'&lt;div class="img-intro"&gt;';
	printf("".'&lt;img%s src="%s" alt="%s" /&gt;' ,
		$images-&gt;image_intro_caption ? ' class="caption"'.' title="' .htmlspecialchars($images-&gt;image_intro_caption) .'"' : '' ,
		htmlspecialchars($images-&gt;image_intro) ,
		htmlspecialchars($images-&gt;image_intro_alt)
	);
	echo   "".'&lt;/div&gt;';
else :
	echo   "".'&lt;div class="img-intro-%s"&gt;&lt;img src="/j25/templates/mda1/img/no_picture_100.png" /&gt;&lt;/div&gt;';
endif;
</pre>
<hr />
<h3>缩略图</h3>
<p>参考来源 trunk/components/com_content/views/category/tmpl/blog_item.php</p>
<pre class="prettyprint linenums">
$images = json_decode($this-&gt;item-&gt;images);
// ……
&lt;?php  if (isset($images-&gt;image_intro) and !empty($images-&gt;image_intro)) : ?&gt;
	&lt;?php $imgfloat = (empty($images-&gt;float_intro)) ? $params-&gt;get('float_intro') : $images-&gt;float_intro; ?&gt;
	&lt;div class="img-intro-&lt;?php echo htmlspecialchars($imgfloat); ?&gt;"&gt;
	&lt;img
		&lt;?php if ($images-&gt;image_intro_caption):
			echo 'class="caption"'.' title="' .htmlspecialchars($images-&gt;image_intro_caption) .'"';
		endif; ?&gt;
		src="&lt;?php echo htmlspecialchars($images-&gt;image_intro); ?&gt;" alt="&lt;?php echo htmlspecialchars($images-&gt;image_intro_alt); ?&gt;"/&gt;
	&lt;/div&gt;
&lt;?php endif; ?&gt;
</pre>
<h3>正文图</h3>
<p>参考来源 trunk/components/com_content/views/article/tmpl/default.php</p>
<pre class="prettyprint linenums">
&lt;?php $images = json_decode($this-&gt;item-&gt;images); ?&gt;
// ……
&lt;?php  if (isset($images-&gt;image_fulltext) and !empty($images-&gt;image_fulltext)) : ?&gt;
&lt;?php $imgfloat = (empty($images-&gt;float_fulltext)) ? $params-&gt;get('float_fulltext') : $images-&gt;float_fulltext; ?&gt;
&lt;div class="img-fulltext-&lt;?php echo htmlspecialchars($imgfloat); ?&gt;"&gt;
&lt;img
	&lt;?php if ($images-&gt;image_fulltext_caption):
		echo 'class="caption"'.' title="' .htmlspecialchars($images-&gt;image_fulltext_caption) .'"';
	endif; ?&gt;
	src="&lt;?php echo htmlspecialchars($images-&gt;image_fulltext); ?&gt;" alt="&lt;?php echo htmlspecialchars($images-&gt;image_fulltext_alt); ?&gt;"/&gt;
&lt;/div&gt;
&lt;?php endif; ?&gt;
</pre>
</body>
</html>
